<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <input type="button" onclick="alert('Hello');"value="test"> 
</head>
<body>
   <input id="btn" type="button" value="test">
   <script>
   document.getElementById('btn').onclick=function(){
       alert(this.value);//获取按钮的value属性，输出结果:test
   };
   </script>
</body>
</html>